import React from 'react'
import { useSearchParams, useLocation } from 'react-router-dom'

export default function Details() {

  const [search, setSearch] = useSearchParams();
  const id = search.get('id');
  const title = search.get('title');
  const content = search.get('content');

  const l = useLocation()
  console.log(l);
  
  return (
    <ul>
      <li>
        <button onClick={() => { setSearch('id=0008&title=哈哈哈&content=嘻嘻') }}>更新search参数</button>
      </li>
      <li>消息ID: {id}</li>
      <li>消息标题: {title}</li>
      <li>消息内容: {content}</li>
    </ul>
  )
}
